470c54
@@ -72,7 +72,7 @@
public class DefaultNettyHttpBinding implements NettyHttpBinding, Cloneable {
     public DefaultNettyHttpBinding(HeaderFilterStrategy headerFilterStrategy) {
         this.headerFilterStrategy = headerFilterStrategy;
     }
-    
+
     public DefaultNettyHttpBinding copy() {
         try {
             return (DefaultNettyHttpBinding)this.clone();
@@ -330,7 +330,7 @@
public class DefaultNettyHttpBinding implements NettyHttpBinding, Cloneable {
         int defaultCode = failed ? 500 : 200;
 
         int code = message.getHeader(Exchange.HTTP_RESPONSE_CODE, defaultCode, int.class);
-        
+
         LOG.trace("HTTP Status Code: {}", code);
 
         // if there was an exception then use that as body
@@ -385,16 +385,16 @@
public class DefaultNettyHttpBinding implements NettyHttpBinding, Cloneable {
                 }
             }
         }
-        
+
         HttpResponse response;
-        
+
         if (buffer != null) {
             response = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.valueOf(code), buffer);
             // We just need to reset the readerIndex this time
             if (buffer.readerIndex() == buffer.writerIndex()) {
                 buffer.setIndex(0, buffer.writerIndex());
             }
-            // TODO How to enable the chunk transport 
+            // TODO How to enable the chunk transport
             int len = buffer.readableBytes();
             // set content-length
             response.headers().set(HttpHeaderNames.CONTENT_LENGTH.toString(), len);
@@ -402,7 +402,7 @@
public class DefaultNettyHttpBinding implements NettyHttpBinding, Cloneable {
         } else {
             response = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.valueOf(code));
         }
-        
+
         TypeConverter tc = message.getExchange().getContext().getTypeConverter();
 
         // append headers
@@ -466,15 +466,12 @@
public class DefaultNettyHttpBinding implements NettyHttpBinding, Cloneable {
 
         String uriForRequest = uri;
         if (configuration.isUseRelativePath()) {
-            int indexOfPath = uri.indexOf((new URI(uri)).getPath());
-            if (indexOfPath > 0) {
-                uriForRequest = uri.substring(indexOfPath);               
-            } 
+            uriForRequest = URISupport.pathAndQueryOf(new URI(uriForRequest));
         }
-        
+
         // just assume GET for now, we will later change that to the actual method to use
         HttpRequest request = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, uriForRequest);
-        
+
         Object body = message.getBody();
         if (body != null) {
             // support bodies as native Netty
@@ -505,7 +502,7 @@
public class DefaultNettyHttpBinding implements NettyHttpBinding, Cloneable {
         // update HTTP method accordingly as we know if we have a body or not
         HttpMethod method = NettyHttpHelper.createMethod(message, body != null);
         request.setMethod(method);
-        
+
         TypeConverter tc = message.getExchange().getContext().getTypeConverter();
 
         // if we bridge endpoint then we need to skip matching headers with the HTTP_QUERY to avoid sending
